package com.cc.chioceFileListView;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;

public class ListSort {

	public static void listSort(ArrayList<String> filePathArrayList){
        ArrayList<String> folderList = new ArrayList<String>();
        ArrayList<String> fileList = new ArrayList<String>();
        for(String string : filePathArrayList){
            if(new File(string).isDirectory()){
                folderList.add(string);
            }else{
                fileList.add(string);
            }
        }
        
        Collections.sort(folderList, String.CASE_INSENSITIVE_ORDER);
        Collections.sort(fileList, String.CASE_INSENSITIVE_ORDER);
        
        filePathArrayList.clear();
        for(String string : folderList){
            filePathArrayList.add(string);
        }
        for(String string : fileList){
            filePathArrayList.add(string);
        }
    }
	
}
